import { Component, OnInit } from '@angular/core';
import { ServiceWelcomeService } from '../service/service-welcome.service';
import { Router } from '@angular/router';
@Component({
  selector: 'app-welcome',
  templateUrl: './welcome.component.html',
  styleUrls: ['./welcome.component.less']
})
export class WelcomeComponent implements OnInit {

  public showLoad:boolean=false
  public sentences:Array<string>=[]
  constructor(
    private serve:ServiceWelcomeService,
    private router:Router
  ) { }

  ngOnInit(): void {
    this.getSentence()
  }

  getSentence(){
    this.serve.getSentence()
    .then((data:any) => {
      this.sentences=data
      console.log(this.sentences);
      
    }
    )
    .catch((err:any) => console.log('err')
    )
  }

  goto(){
    this.showLoad = !this.showLoad
    const leftBox:any = document.querySelector(".leftBox")
    leftBox.style.animation = "leftMove 2s forwards"
    const rightBox:any = document.querySelector(".rightBox")
    rightBox.style.animation = "rightMove 2s forwards"
    setTimeout(()=>{this.router.navigate(['/home/main'])},2000)
  }

}
